﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Model;
using BLL;

namespace 联盟酒店
{
    public partial class order : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            nameper.Value = Session["name"].ToString();
            tel.Value = Session["tel"].ToString();
            if (!IsPostBack)
                showmake();
        }
        public void showmake()
        {
            string id = Request.QueryString["id"];
            roomtypesmodel rm = BLL.roomtypesBLL.showmake(id);
            roomtype.Value = rm.roomtype.ToString();
            price.Value = rm.price.ToString();


        }

        protected void btnmake_Click(object sender, EventArgs e)
        {

            string id = Request.QueryString["id"];
            Session["roomtid"] = id;
            int a = Convert.ToInt32(id);
            makemodel ma = new makemodel();
            ma.begtime = Convert.ToDateTime(begtame.Value);
            ma.endtime = Convert.ToDateTime(endtime.Value);
            ma.people = Convert.ToInt32(peoples.Value);
            int r = BLL.makebll.insertmake(ma, id);
            if (r > 0)
            {
                Response.Write("<script>alert('预约成功可在个人中心查看');location.href=('/personal.aspx');</script>");

            }
            else
            {
                Response.Write("<script>alert('支付失败')</script>");
            }
        }

        protected void btnmake_Command(object sender, CommandEventArgs e)
        {

        }
    }
}